﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TheWorldsWorst.ApiWrapper;

namespace WebTestApp
{
    public partial class _Default : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnShowQuestion_Click(object sender, EventArgs e)
        {
            var question = ApiProxy.GetQuestionFor(Convert.ToInt32(TextBox1.Text));
            string defTemplate = "<html><head><title></title><style type=\"text/css\">.style1{font-family: \"Times New Roman\", Times, serif;font-size: large;} .style2 { font-size: small; font-family: Arial, Helvetica, sans-serif; } </style></head><body> <p class=\"style1\">   <strong>{{TITLE}}</strong></p> <p class=\"style2\" style=\"background-color: #6699FF\">{{BODY}}</p><hr size=\"1\" /></body><html>";

            defTemplate = defTemplate.Replace("{{TITLE}}", question.Title);
            defTemplate = defTemplate.Replace("{{BODY}}", question.Body);

            TinyMCEEditor1.Text = defTemplate;
        }
    }
}
